﻿<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>公司新闻管理</title>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/skin/admin/css/base.css">

<script language="javascript">

function viewArc(aid){

	if(aid==0) aid = getOneItem();

	window.open("archives.asp?aid="+aid+"&action=viewArchives");

}

function editArc(aid){

	if(aid==0) aid = getOneItem();

	location="archives.asp?aid="+aid+"&action=editArchives";

}

function updateArc(aid){

	var qstr=getCheckboxItem();

	if(aid==0) aid = getOneItem();

	location="archives.asp?aid="+aid+"&action=makeArchives&qstr="+qstr+"";

}

function checkArc(aid){

	var qstr=getCheckboxItem();

	if(aid==0) aid = getOneItem();

	location="archives.asp?aid="+aid+"&action=checkArchives&qstr="+qstr+"";

}

function moveArc(aid){

	var qstr=getCheckboxItem();

	if(aid==0) aid = getOneItem();

	location="archives.asp?aid="+aid+"&action=moveArchives&qstr="+qstr+"";

}

function adArc(aid){

	var qstr=getCheckboxItem();

	if(aid==0) aid = getOneItem();

	location="archives.asp?aid="+aid+"&action=commendArchives&qstr="+qstr+"";

}

function delArc(aid){
	var qstr=getCheckboxItem();
	
	if(aid==0) aid = getOneItem();

	location="/Admin.php?m=Zhaopin&a=del&id="+aid+"&qstr="+qstr;
	
}



//获得选中文件的文件名

function getCheckboxItem()

{

	var allSel="";

	if(document.form2.id.value) return document.form2.id.value;

	for(i=0;i<document.form2.id.length;i++)

	{

		if(document.form2.id[i].checked)

		{

			if(allSel=="")

				allSel=document.form2.id[i].value;

			else

				allSel=allSel+","+document.form2.id[i].value;

		}

	}

	return allSel;

}



//获得选中其中一个的id

function getOneItem()

{

	var allSel="";

	if(document.form2.id.value) return document.form2.id.value;

	for(i=0;i<document.form2.id.length;i++)

	{

		if(document.form2.id[i].checked)

		{

				allSel = document.form2.id[i].value;

				break;

		}

	}

	return allSel;

}

function selAll()

{

	for(i=0;i<document.form2.id.length;i++)

	{

		if(!document.form2.id[i].checked)

		{

			document.form2.id[i].checked=true;

		}

	}

}

function noSelAll()

{

	for(i=0;i<document.form2.id.length;i++)

	{

		if(document.form2.id[i].checked)

		{

			document.form2.id[i].checked=false;

		}

	}

}

</script>

</head>

<body leftmargin="8" topmargin="8" background='__PUBLIC__/skin/images/allbg.gif'>



<!--  快速转换位置按钮  -->

<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D1DDAA" align="center">

<tr>

 <td height="26" background="__PUBLIC__/skin/images/newlinebg3.gif">

  <table width="98%" border="0" cellspacing="0" cellpadding="0">

  <tr>

  <td align="center">文章管理</td>

 </tr>

</table>

</td>

</tr>
</table>
<form name="form1" method="post" action="">
<table width="98%" border="0" cellpadding="0" cellspacing="1"  align="center">
	<tr><td>

		<input name="keywords" maxlength="40" size=30 placeholder="请输入您要查询的内容关键字..." >

		<input type="submit" name="search" value="搜索">

		</td></tr>
</table>
</form>
<!--  内容列表   -->

<form name="form2">



<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">

<tr bgcolor="#E7E7E7">

	<td height="24" colspan="10" background="__PUBLIC__/skin/images/tbg.gif">&nbsp;文档列表&nbsp;</td>

</tr>

<tr align="center" bgcolor="#FAFAF1" height="22">



	<td width="50">选择</td>
    <td width="9%">城市</td>

	<td>内容标题</td>

	<td width="18%">录入时间</td>





	<td width="100">发布人</td>

		<td width="11%">状态</td>

	<td width="150">操作</td>

</tr>

<foreach name="list" item="vo">

<tr align='center' bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22" >

	

	<td><input name="id" type="checkbox" id="id"  value="{$vo['id']}" class="np"></td>
<td width="9%">{$vo.city}</td>
	<td align="left"><a href='{:U('read',array('id'=>$vo['id']))}'><u>{$vo.title}</u></a></td>

	<td>{$vo.createtime|date="Y-m-d",###}</td>







	<td>{$vo.uname}</td>

	<td><eq name="vo.status" value="0"><a href="{:U('shenhe',array('id'=>$vo['id']))}"><span style="color:#FF0000;">仅审核</span></a><br/> <a href="{:U('shenhe',array('id'=>$vo['id'],'xzh_post'=>1))}"><span style="color:#FF0000;">普通推送</span></a><br/><a href="{:U('shenhe',array('id'=>$vo['id'],'xzh_post'=>2))}"><span style="color:#FF0000;">原创推送</span></a>

	  <else/>已通过</eq>

</td>

	<td><a href="{:U('edit',array('id'=>$vo['id']))}">编辑 </a> |<a href="{:U('read',array('id'=>$vo['id']))}">查看 </a> | <a href="{:U('del',array('id'=>$vo['id']))}">删除</a>
		 |<a href="#" class="showSpread" id="showSpread-{$vo['id']}" dataId="{$vo['id']}" spread_sort="{$vo['spread_sort']}" expired="{$vo['spread_sort_time']}"><eq name="vo.spread_sort" value="0">未推广<else/><if condition="strtotime($vo['spread_sort_time']) lt time() ">已过期<else/>推广中</if></eq></a></td>

</tr></foreach>



<tr bgcolor="#FAFAF1">

<td height="28" colspan="10">

	&nbsp;

	<a href="javascript:selAll()" class="coolbg">全选</a>

	<a href="javascript:noSelAll()" class="coolbg">取消</a>
 
    <a href="javascript:delArc(0)" class="coolbg">&nbsp;删除&nbsp;</a>


</td>

</tr>



<tr align="right" bgcolor="#EEF4EA">

	<td height="36" colspan="10" align="center"><!--翻页代码 -->{$page}</td>

</tr>

</table>



</form>



<!--  搜索表单  -->
<!-- 
<form name='form3' action='__URL__/search/' method='get'>

<input type='hidden' name='dopost' value='' />

<table width='98%'  border='0' cellpadding='1' cellspacing='1' bgcolor='#CBD8AC' align="center" style="margin-top:8px">

  <tr bgcolor='#EEF4EA'>

    <td background='skin/images/wbg.gif' align='center'>

      <table border='0' cellpadding='0' cellspacing='0'>

        <tr>

          <td width='90' align='center'>搜索条件：</td>

          <td width='160'>

          <select name='cid' style='width:150'>

          <option value='0'>选择类型...</option>

          	<option value='1'>名称</option>

          </select>

        </td>

        <td width='70'>

          关键字：

        </td>

        <td width='160'>

          	<input type='text' name='keyword' value='' style='width:150px' />

        </td>

        <td width='110'>

    		<select name='orderby' style='width:80px'>

            <option value='id'>排序...</option>

            <option value='creat_time'>发布时间</option>

      	</select>

        </td>

        <td>

          <input name="imageField" type="image" src="__PUBLIC__/skin/img/frame/search.gif" width="45" height="20" border="0" class="np" />

        </td>

       </tr>

      </table>

    </td>

  </tr>

</table>

</form>

-->
<div id="modal">
	<style>
		#modal {
			display: none;
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			background: rgba(0, 0, 0, 0.3);
		}
		#modal .content {
			background: #fff;
			width: 300px;
			min-height: 100px;
			padding: 30px 15px;
			position: absolute;
			left: 50%;
			top: 50%;
			margin-top: -150px;
			margin-left: -150px;
		}
		#modal .content input[type=text] {
			width: 220px;
			height: 30px;
			line-height: 30px;
			text-indent: 5px;
			border-color: #ccc;
		}
		#modal .content input[type=text]:hover{
			border-color: #21b384;
		}
		#modal .content h2{
			font-size: 24px;
			margin-bottom: 15px;
			color: #333;
		}
		#modal .content .button{
			margin-top: 20px;
			text-align: center;
		}
		#modal .content input[type=button] {
			width: 130px;
			height: 30px;
			text-align: center;
			line-height: 30px;
			background: #21b384;
			color: #fff;
			border: 0 none;
			font-size: 16px;
			cursor: pointer;
		}
		#modal .content input.cancle {
			background: #ccc;
		}
	</style>
	<div class="content">
		<h2>推广设置</h2>
		<form action=""  method="post" onsubmit="return false;">
			<table>
				<tr><td>排序：</td><td><input type="text" value="0" name="sort"></td></tr>
				<tr><td>过期时间：</td><td><input type="text" value="" name="expired_at"></td></tr>
			</table>
			<div class="button">
				<input type="button" value="确定" class="submit"> <input type="button" value="取消" class="cancle">
			</div>
			<input type="hidden" name="id" value="">
		</form>
	</div>
</div>
</body>

</html>
<script src="__PUBLIC__/js/jquery-ui-1.12.1/external/jquery/jquery.js"></script>
<script src="__PUBLIC__/js/jquery-ui-1.12.1/jquery-ui.min.js"></script>
<link href="__PUBLIC__/js/jquery-ui-1.12.1/jquery-ui.css" rel="stylesheet" />
<script src="__PUBLIC__/js/jquery-ui-1.12.1/jquery-ui-timepicker-addon.js"></script>
<script src="__PUBLIC__/js/jquery-ui-1.12.1/jquery-ui-timepicker-zh-CN.js"></script>
<link href="__PUBLIC__/js/jquery-ui-1.12.1/jquery-ui-timepicker-addon.css" rel="stylesheet" />


<script>
	$(function(){
		var modal 		= $('#modal'),
				modalSort	= modal.find('input[name=sort]'),
				modalExpiredAt 	= modal.find('input[name=expired_at]'),
				modalSubmit		= modal.find('.submit'),
				modalCancle		= modal.find('.cancle'),
				modalForm		= modal.find('form')
				modalFormId		= modal.find('input[name=id]')
				;

		modalExpiredAt.datetimepicker({
			dateFormat: "yy-mm-dd",
			timeFormat: "hh:mm:ss",
		});

		$('.showSpread').click(function(){
			var that = $(this),
					id = that.attr('dataId'),
					sort = that.attr('spread_sort'),
					expired = that.attr('expired');
			modalFormId.val(id);
			modalSort.val(sort);
			modalExpiredAt.datetimepicker('setDate', (new Date(expired)) );
			modal.show();

		})
		//推广排序 按下回车键
		var isAjax = false;
		modalForm.keyup(function(event){
			if(event.keyCode ==13){
				submitModal();
				return false;
			}
			return false;
		});
		modalSubmit.click(function(){
			submitModal()
		})
		modalCancle.click(function() {
			modal.hide();
		})

		function submitModal()
		{
			var sort = modalSort.val();
			sort = sort.replace(' ', '');
			var pattern = /^[0-9]+$/;
			if (!pattern.test(sort))
			{
				alert('请输入数字');
				return false;
			}
			if (isAjax)
			{
				return false;
			}
			isAjax = true;
			var formData = modalForm.serialize();
			$.post('/Admin.php?m=Zhaopin&a=spreadSort', formData, function(data){
				$('#showSpread-'+modalFormId.val()).attr('expired', modalExpiredAt.val()).attr('spread_sort', modalSort.val());
				if (modalSort.val() > 0)
				{
					$('#showSpread-'+modalFormId.val()).html('推广中');
				} else {
					$('#showSpread-'+modalFormId.val()).html('未推广');
				}
				modalForm[0].reset();
				isAjax = false;
				modal.hide();
			}, 'json');
		}
	})
</script>